Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body onclick="myFunction(event)"> <p>Click on a paragraph. An alert box will alert the element whose eventlistener triggered the event.</p> <p><strong>Note:</strong> The currentTarget property does not necessarily return the element that was clicked on, but the element whose eventlistener triggered the event.</p> <script> function myFunction(event) { alert(event.currentTarget.nodeName); } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=try_dom_event_currenttarget by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:30:32 GMT --> </html>
Result:
Try it Yourself - © w3schools.com